package com.taoxi.shops.service.impl;

import com.taoxi.common.utils.DateUtils;
import com.taoxi.shops.domain.Wholesaler;
import com.taoxi.shops.mapper.WholesalerMapper;
import com.taoxi.shops.service.IWholesalerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 批发商管理Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-24
 */
@Service
public class WholesalerServiceImpl implements IWholesalerService {
    @Autowired
    private WholesalerMapper wholesalerMapper;

    /**
     * 查询批发商管理
     *
     * @param id 批发商管理主键
     * @return 批发商管理
     */
    @Override
    public Wholesaler selectWholesalerById(Long id) {
        return wholesalerMapper.selectWholesalerById(id);
    }

    /**
     * 查询批发商管理列表
     *
     * @param wholesaler 批发商管理
     * @return 批发商管理
     */
    @Override
    public List<Wholesaler> selectWholesalerList(Wholesaler wholesaler) {
        return wholesalerMapper.selectWholesalerList(wholesaler);
    }

    /**
     * 新增批发商管理
     *
     * @param wholesaler 批发商管理
     * @return 结果
     */
    @Override
    public int insertWholesaler(Wholesaler wholesaler) {
        wholesaler.setCreateTime(DateUtils.getNowDate());
        return wholesalerMapper.insertWholesaler(wholesaler);
    }

    /**
     * 修改批发商管理
     *
     * @param wholesaler 批发商管理
     * @return 结果
     */
    @Override
    public int updateWholesaler(Wholesaler wholesaler) {
        wholesaler.setUpdateTime(DateUtils.getNowDate());
        return wholesalerMapper.updateWholesaler(wholesaler);
    }

    /**
     * 批量删除批发商管理
     *
     * @param ids 需要删除的批发商管理主键
     * @return 结果
     */
    @Override
    public int deleteWholesalerByIds(Long[] ids) {
        return wholesalerMapper.deleteWholesalerByIds(ids);
    }

    /**
     * 删除批发商管理信息
     *
     * @param id 批发商管理主键
     * @return 结果
     */
    @Override
    public int deleteWholesalerById(Long id) {
        return wholesalerMapper.deleteWholesalerById(id);
    }

    @Override
    public List<Wholesaler> getSalesSort(Wholesaler wholesaler) {
        return wholesalerMapper.getSalesSort(wholesaler);
    }
}
